using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NewAndong.Entity;
using NewAndong.Model;
using NewAndong.Service;
using Leeder.Business;

namespace NewAndong.Business
{
    /// <summary>
    /// 
    /// </summary>
   public class SignalLampDirectionBLL : BaseBLL<SignalLampDirectionModel, SignalLampDirectionService>
   {
        public SignalLampDirectionBLL()
        {
            Service = new SignalLampDirectionService();
        }

        public List<SignalLampDirectionModel> GetModelList()
        {
            var result = Service.Query(p => (!p.IsPhantom || p.IsPhantom == null));
            if (!result.IsSuccess)
            {
                LogObj.Error(result.Dsca);
                return new List<SignalLampDirectionModel>();
            }
            return result.ActivedObj;
        }

        public List<SignalLampDirectionModel> GetModelListBySignalMark(string signalMark)
        {
            var result = Service.Query(p => (!p.IsPhantom || p.IsPhantom == null)&& p.SignalMark== signalMark);
            if (!result.IsSuccess)
            {
                LogObj.Error(result.Dsca);
                return new List<SignalLampDirectionModel>();
            }
            return result.ActivedObj;
        }


        public List<SignalLampDirectionModel> GetListByGroupName(string groupName)
        {
            var result = Service.Query(p => (!p.IsPhantom || p.IsPhantom == null) && p.TypeName == groupName);
            if (!result.IsSuccess)
            {
                LogObj.Error(result.Dsca);
                return new List<SignalLampDirectionModel>();
            }
            return result.ActivedObj;
        }

        public List<SignalLampDirectionModel> GetModelByNameOrSpecMark(string name)
        {
            var result = Service.Query(p => (!p.IsPhantom || p.IsPhantom == null)&&(p.LampName == name));
            if (!result.IsSuccess)
            {
                LogObj.Error(result.Dsca);
                return new List<SignalLampDirectionModel>();
            }
            return result.ActivedObj;
        }
    }
}
